<?php

/**
 * Comision form base class.
 *
 * @method Comision getObject() Returns the current form's model object
 *
 * @package    saveenergy
 * @subpackage form
 * @author     0
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseComisionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'contrato_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contrato'), 'add_empty' => false)),
      'pago'        => new sfWidgetFormInputText(),
      'fechaPago'   => new sfWidgetFormDate(),
      'cobro'       => new sfWidgetFormInputText(),
      'fechaCobro'  => new sfWidgetFormDate(),
      'comercial'   => new sfWidgetFormInputText(),
      'director'    => new sfWidgetFormInputText(),
      'compania_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Compania'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'contrato_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contrato'))),
      'pago'        => new sfValidatorInteger(),
      'fechaPago'   => new sfValidatorDate(),
      'cobro'       => new sfValidatorInteger(),
      'fechaCobro'  => new sfValidatorDate(),
      'comercial'   => new sfValidatorInteger(),
      'director'    => new sfValidatorInteger(),
      'compania_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Compania'))),
    ));

    $this->widgetSchema->setNameFormat('comision[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Comision';
  }

}
